Imports System.Data

Partial Class Mngt_Info_Reports
    Inherits WebPageCommon
    Const RptPath As String = "~/Management_Info/"
    '#0C58A2 - Selected
    '"~/images/redT.PNG" - Selected

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dm As New DAOMain.CommonDAO

        InitVars()

        With dm
            Dim strRole As String = Session("UserName")

            .AddParameter(strRole)
            Dim dt As DataTable = .ExecQryProc("sp_get_report_display_access")

            Datagrid.DataSource = dt
            Datagrid.DataBind()

            dt = Nothing
        End With

        dm = Nothing
    End Sub


    Protected Sub Datagrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles Datagrid.ItemDataBound
        If Trim(e.Item.Cells(3).Text) <> "&nbsp;" Then
            Dim pfunc As New PolyFunc.Secure
            Dim lbtnReport As LinkButton = e.Item.FindControl("lbtnReport")

            If Not IsNothing(lbtnReport) Then
                lbtnReport.Attributes.Add("onclick", "popUp('Generate.aspx?rid=" & pfunc.EncodeBase64(e.Item.Cells(0).Text) & "');")
            End If

            pfunc = Nothing

        ElseIf Trim(e.Item.Cells(5).Text) <> "&nbsp;" Then
            Dim lbtnReport As LinkButton = e.Item.FindControl("lbtnReport")

            If Not IsNothing(lbtnReport) Then
                lbtnReport.Attributes.Add("onclick", "popUp('" & e.Item.Cells(5).Text & "');")
            End If
        End If
        
    End Sub
End Class
